﻿//using System;
//using System.Collections.Generic;
//using System.Text;
//using DCRF.Common.Core;
//using DCRF.Common.Primitive;
//using DCRF.Common.Helper;
//using System.Reflection;
//using DCRF.Common.DBC;
//using DCRF.Common.Interface;
//using DCRF.Common.Support;
//using DCRF.Common.Definition;

//namespace DCRF.BaseBlocks
//{
//    public class Binder: BlockBase
//    {
//        public override BlockInfo BlockInfo
//        {
//            get
//            {
//                BlockInfo result = new BlockInfo();
//                result.BlockID = new CID("Binder", new BlockVersion(1, 0, 0, 0), "DCRF");
//                return result;
//            }
//        }

//        public override void InitConnectors()
//        {
//            Connectors.CreateConnector("BindingSource", ConnectorType.Property); //source from which we read data (property)
//            Connectors.CreateConnector("BindingTarget", ConnectorType.Service); //target to which we send source data and get result (service) and save back to source
//        }

//        protected override void onConnectorAttached(string key)
//        {
//            if (key == "BindingSource")
//            {
//                //now we need to attach to the propertyreading event of the binding source
//                Connector c = Connectors["BindingSource"];

//                BlockWeb[c.Handle].GetPropertyItem(c.ServiceName).ReadingProperty += new PropertyItemReadingDelegate(Binder_ReadingProperty);
//            }
            
//        }

//        void Binder_ReadingProperty(PropertyItem sender, ref object value, ref bool useProvidedValueAndAbort)
//        {
//            Connector c = Connectors["BindingTarget"];

//            value = c.ProcessRequest(value);

//            //do not use original value, use the value we have provided
//            useProvidedValueAndAbort = true;
//        }
//    }
//}
